package com.fpx.open.platform.domain;

import java.io.Serializable;
import java.util.Date;

/**
 * 用户信息扩展类，用于兼容老版本api，保存老版本的一些信息
 *
 * @author sunkey
 * @date Apr 23, 2013 10:38:23 AM
 * @version 1.0.0
 */
public class UserInfoExt implements Serializable {
	
	public static final Short NO_OLD_SYS = 0; 
	
	/**
	 * 用户ID,对应userInfo id
	 */
    private Integer userId;

    /**
     * 用户令牌，老API的
     */
    private String token;

    /**
     * 用户类型，例如oms,fop等系统名称作为类型
     */
    private String type;

    /**
     * 是否老系统：0:调用新系统api,1:调用老系统api,默认为0,目前oms为用到
     */
    private Short isOldSys;

    private Date dateUpdated;

    private Date dateCreated;
    
    private UserInfo userInfo;

    private static final long serialVersionUID = 1L;

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token == null ? null : token.trim();
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type == null ? null : type.trim();
    }

    public Short getIsOldSys() {
        return isOldSys;
    }

    public void setIsOldSys(Short isOldSys) {
        this.isOldSys = isOldSys;
    }

    public Date getDateUpdated() {
        return dateUpdated;
    }

    public void setDateUpdated(Date dateUpdated) {
        this.dateUpdated = dateUpdated;
    }

    public Date getDateCreated() {
        return dateCreated;
    }

    public void setDateCreated(Date dateCreated) {
        this.dateCreated = dateCreated;
    }
    
    public UserInfo getUserInfo() {
		return userInfo;
	}

	public void setUserInfo(UserInfo userInfo) {
		this.userInfo = userInfo;
	}

	@Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        UserInfoExt other = (UserInfoExt) that;
        return (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getToken() == null ? other.getToken() == null : this.getToken().equals(other.getToken()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getIsOldSys() == null ? other.getIsOldSys() == null : this.getIsOldSys().equals(other.getIsOldSys()))
            && (this.getDateUpdated() == null ? other.getDateUpdated() == null : this.getDateUpdated().equals(other.getDateUpdated()))
            && (this.getDateCreated() == null ? other.getDateCreated() == null : this.getDateCreated().equals(other.getDateCreated()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getToken() == null) ? 0 : getToken().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getIsOldSys() == null) ? 0 : getIsOldSys().hashCode());
        result = prime * result + ((getDateUpdated() == null) ? 0 : getDateUpdated().hashCode());
        result = prime * result + ((getDateCreated() == null) ? 0 : getDateCreated().hashCode());
        return result;
    }
}